package com.android.syssetting

import android.content.Intent
import android.net.Uri
import android.os.Build
import android.provider.Settings
import android.view.View
import androidx.activity.viewModels
import androidx.lifecycle.Observer
import com.android.syssetting.databinding.ActivitySystemSettingBinding
import com.camera.base.v.BaseActivity
import com.camera.routemodule.RouterPath
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.android.syssetting.models.BrightnessViewModel
import com.android.syssetting.models.SysSettingModel
import com.camera.base.util.APPUtil
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = RouterPath.path.syssetting_activity)
class SysSettingActivity: BaseActivity<ActivitySystemSettingBinding,SysSettingModel>() {
    override val viewModelClass: Class<SysSettingModel>
        get() = SysSettingModel::class.java
    override fun getLayoutId(): Int {
        return R.layout.activity_system_setting
    }

    override fun getStatusBarColor(): Int {
        return R.color.title_background_color
    }

    override fun loadData() {
        mBinding.viewModel = viewModel
        // SystemNavBarViewModel已通过注入方式在SysSettingModel中提供
        
        viewModel.showLodingDialogIdEvent.observe(this) { (show, message) ->
            if (show) {
                showLoadingDialog(resources.getString(message))
            } else {
                hideLoadingDialog()
            }
        }
    }

    override fun initView() {

    }

    fun myClick(v: View){
        when(v.id){
            R.id.civ_activity_sys_setting_brightness -> {
                ARouter.getInstance().build(RouterPath.path.brightness_activity).withTransition(R.anim.slide_in_right, R.anim.slide_out_left).navigation()
            }
            R.id.civ_activity_sys_setting_volume -> {
                ARouter.getInstance().build(RouterPath.path.volume_activity).withTransition(R.anim.slide_in_right, R.anim.slide_out_left).navigation()
            }
            R.id.civ_activity_sys_setting_network -> {
                val intent = Intent(Settings.ACTION_WIRELESS_SETTINGS)
                startActivity(intent)
            }
            R.id.civ_activity_sys_info -> {
                ARouter.getInstance().build(RouterPath.path.sys_info_activity).withTransition(R.anim.slide_in_right, R.anim.slide_out_left).navigation()
            }
            R.id.civ_activity_about -> {
                ARouter.getInstance().build(RouterPath.path.upgrade_activity).withTransition(R.anim.slide_in_right, R.anim.slide_out_left).navigation()
            }
        }
    }
}